<?php


namespace app\api\controller\xiluedu;


use app\common\controller\Api;
use app\common\model\xiluedu\Category;

class CourseCategory extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];
    /**
     * 商品分类(二层)
     */
    public function list_tree(){
        $lists = Category::listTree();
        $this->success('查询成功',$lists);
    }

    /**
     * 商品分类(根据id获取下级分类)
     * @param integer category_id 分类id
     */
    public function children(){
        $category_id = $this->request->param('category_id');
        if(!$category_id) {
            $category_id = 0;
        }
        $lists = Category::lists($category_id);
        $this->success('查询成功',$lists);
    }

}